package com.xoa.dev.pz.controller;
/*
    created by 王志伟 on 2017/12/2


 */

import com.xoa.dev.pz.model.PzEasyAccidentWithBLOBs;
import com.xoa.dev.pz.service.impl.PzEasyAccidentService;
import com.xoa.util.ToJson;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/PzEasyAccident")
public class PzEasyAccidentController {

    @Resource
    PzEasyAccidentService pzEasyAccidentService;


    /*
    created by 王志伟 on 2017/12/2
    添加易肇事人员信息

    */
    @ResponseBody
    @RequestMapping("/insertInformation")
    public ToJson<PzEasyAccidentWithBLOBs> insertInformation(PzEasyAccidentWithBLOBs pzEasyAccidentWithBLOBs, HttpServletRequest request) {
        return pzEasyAccidentService.insertInformation(pzEasyAccidentWithBLOBs, request);
    }

    /*
    created by 王志伟 on 2017/12/2
    更新易肇事人员信息

    */
    @ResponseBody
    @RequestMapping("/updateInformation")
    public ToJson<PzEasyAccidentWithBLOBs> updateInformation(HttpServletRequest request, PzEasyAccidentWithBLOBs pzEasyAccidentWithBLOBs) {
        return pzEasyAccidentService.updateInformation(request,pzEasyAccidentWithBLOBs);
    }

    /*
    created by 王志伟 on 2017/12/2
    删除易肇事人员信息

    */
    @ResponseBody
    @RequestMapping("/deleteInformation")
    public ToJson<PzEasyAccidentWithBLOBs> deleteInformation(HttpServletRequest request, Integer easyAccidentId) {
        return pzEasyAccidentService.deleteInformation(request,easyAccidentId);
    }

    /*
    created by 王志伟 on 2017/12/2
    分页查询易肇事人员信息 和导出信息

    */
    @ResponseBody
    @RequestMapping("/selectByLimit")
    public ToJson<PzEasyAccidentWithBLOBs> selectByLimit(HttpServletResponse response, HttpServletRequest request, PzEasyAccidentWithBLOBs pzEasyAccidentWithBLOBs, Integer page, Integer pageSize, boolean useFlag, String export, String pCradId, String pName) {
        return pzEasyAccidentService.selectByLimit(response,request,pzEasyAccidentWithBLOBs, page, pageSize, useFlag,export,pCradId,pName);
    }

    /**
     * 张丽军：导入接口
     * @param request
     * @param response
     * @param file
     * @param session
     * @return
     */
    @ResponseBody
    @RequestMapping("/importEasyAccident")
    public ToJson importEasyAccident(HttpServletRequest request, HttpServletResponse response, MultipartFile file, HttpSession session){
        return pzEasyAccidentService.importEasyAccident(request,response,file,session);
    }
    /*
    created by 王志伟 on 2017/12/2
    通过主键查询易肇事人员信息

    */
    @ResponseBody
    @RequestMapping("/selectById")
    public ToJson<PzEasyAccidentWithBLOBs> selectById(Integer easyAccidentId, HttpServletRequest request) {
        return pzEasyAccidentService.selectById(easyAccidentId,request);
    }

    /*
        created by 张雨 on 2017/12/2
        易肇事人员列表页

    */
    @RequestMapping("/easyAccidentList")
    public String runPsychosis() {
        return "app/pz/pzEasyAccident/runPsychosis";
    }

    //流动人口首页
    @RequestMapping("/basicMsg")
    public String basicMsg() {
        return "app/pz/pzEasyAccident/basicInfo";
    }

    //流动人口首页
    @RequestMapping("/businessInfo")
    public String businessInfo() {
        return "app/pz/pzEasyAccident/businessInfo";
    }


    /*

    creaed by 刘旭 on 2017/12/5
    校园周边环境安全页面的调试
*/
@RequestMapping("/lxTest")
public String lxTest(){return "app/pz/pzEasyAccident/gridXyzbhj";}
}

